]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Properly clean up if PickColor() is cancelled
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 28 May 2020 22:27:34 +0000 (00:27 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 28 May 2020 22:52:33 +0000 (00:52 +0200)
We currently only remove the screenshot operation from the shooter
map if the color pick operation completed successfully, but not if
it was cancelled. As a result, we now reject any further requests
from the same sender because we assume that there is an ongoing
operation.

Fix this by moving the cleanup to a finally clause that runs for
both code paths.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1288

js/ui/screenshot.js

index 5b7e0938721cee0510f7311a4ecb3241137f0cf1..de5d3c0630ecce5075d478e9b2fab926f32602cb 100644 (file)
@@ -276,12 +276,13 @@ var ScreenshotService = class {
                     blue / 255.0,
                 ]),
             }]);
-            this._removeShooterForSender(invocation.get_sender());
             invocation.return_value(retval);
         } catch (e) {
             invocation.return_error_literal(
                 Gio.IOErrorEnum, Gio.IOErrorEnum.CANCELLED,
                 'Operation was cancelled');
+        } finally {
+            this._removeShooterForSender(invocation.get_sender());
         }
     }
 };